package org.oslims.client.uicomponents.editbox;

import org.oslims.client.uicomponents.inputfields.TextInputField;

import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class EnterStoragePlaceBox {

	final DialogBox dialogBox = new DialogBox(false, true);
	final VerticalPanel boxPanel = new VerticalPanel();

	final TextInputField storagePlace = new TextInputField("storagePlace", "Storage Place: ", "80px", "200px");

	final HorizontalPanel buttonLine = new HorizontalPanel();
	final Button saveButton = new Button("Save");
	final Button cancelButton = new Button("Cancel");

	public EnterStoragePlaceBox() {
		boxPanel.add(storagePlace);

		buttonLine.add(saveButton);
		buttonLine.add(cancelButton);
		boxPanel.add(buttonLine);

		dialogBox.setText("Enter the storage place for the selected samples");
		dialogBox.add(boxPanel);
	}

	public HasValue<String> getStoragePlaceField() {
		return storagePlace.getInputField();
	}

	public void show() {
		storagePlace.getInputField().setValue("");
		dialogBox.center();
	}

	public HasClickHandlers getSaveButton() {
		return saveButton;
	}

	public HasClickHandlers getCancelButton() {
		return cancelButton;
	}

	public void hide() {
		dialogBox.hide();
	}
}
